import React, { Component } from 'react'
import store from '../../store'

// export default function One() {
//     const add = () => {
//         store.dispatch({ type: "ADD_NUM" })
//     }
//     return (
//         <div>
//             One --- { store.getState().num }
//             <button onClick = { add }>++++</button>
//         </div>
//     )
// }


export default class One extends Component {
    constructor() {
        super()
        store.subscribe(() => {
            this.setState({})
        })
    }

    add = () => {
        store.dispatch({ type: "ADD_NUM" })
    }
    render() {
        return (
            <div>
                One --- {store.getState().num}
                <button onClick={this.add}>++++</button>
            </div>
        )
    }
}

